close all;clc;clear;
%% Activity 1: Basic Image Operations 基本图像操作
fig = figure(1);
im_board = board_position(4,3);                 % 寻找国际象棋相应棋盘位置的状态
saveas(fig,'exp2_1.jpg');                       % 保存figure效果图

%% Activity 2: Spot the Difference 找区别
im = imread('spot_the_difference.png');         % 读取图像
im_info = imfinfo('spot_the_difference.png');   % 读取图像的一些信息
im1 = im(:,1:350,:);                            % 分割第一幅图
im2 = im(:,351:700,:);                          % 分割第二幅图
im_diff = im1-im2;                              % 矩阵直接相减得到图像差异
im_diff = rgb2gray(im_diff);                    % 转为灰度图
im_diff = im_diff>40;                           % 像素大于40全为白
im_diff = cat(3,im_diff*255,zeros(size(im_diff)),zeros(size(im_diff))); % 不同处标记为红色
im_diff = uint8(im_diff);                       % 图像格式变换
im_diff = imlincomb(0.4,im1,5,im_diff,'uint8'); % 两个矩阵线性叠加
fig = figure(2);
subplot(1,3,1);imshow(im1);
subplot(1,3,2);imshow(im2);
subplot(1,3,3);imshow(im_diff);
saveas(fig,'exp2_2.jpg');                       % 保存figure效果图

